<?php

namespace app\controller\sys;

use app\BaseController;
use app\model\StationBasic;
use app\model\StationPriceTask;
use think\Response;
use yly_print\YlyOpen;

class Station extends BaseController
{
    public function save(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->addOrUpdate());
    }

    public function lst(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->lst());
    }

    public function detail(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->detail());
    }

    public function series(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->series());
    }

    public function state(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->state());
    }

    public function city(): Response
    {
        return $this->success($this->app->make(StationBasic::class)->city());
    }

    public function task_save(): Response
    {
        return $this->success($this->app->make(StationPriceTask::class)->addOrUpdata());
    }

    public function task_list()
    {
        return $this->success($this->app->make(StationPriceTask::class)->lst());
    }

    public function printer_test()
    {
        $param = $this->request->post();
        return $this->success($this->app->make(YlyOpen::class,['id'=>$param['print_sn'],"token"=>$param['print_key']])->testPrinter($param['print_sn']));
    }
}
